import { uniqueId } from 'lodash'

/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

export const menuHeader = supplementPath([
  // { path: '/index', title: '首页', icon: 'home' },
  // { path: '/users', title: '用户管理', icon: 'user' },
  // { path: '/banners', title: '轮播管理', icon: '' },
  // { path: '/task-classify', title: '任务分类管理', icon: '' },
  // { path: '/task-cycle', title: '周期任务', icon: '' },
  // { path: '/withdraws', title: '提现审核', icon: '' },
  // { path: '/basic', title: '基础设置', icon: '' }
])

export const menuAside = supplementPath([
  { path: '/index', title: '首页', icon: 'home' },
  { path: '/users', title: '用户管理', icon: 'user' },
  { path: '/banners', title: '轮播管理', icon: 'picture-o' },
  { path: '/task-classify', title: '任务分类管理', icon: 'calendar-o' },
  {
    title: '任务管理',
    icon: 'folder-o',
    children: [
      { path: '/task/suspended', title: '任务审核' },
      { path: '/task/manage', title: '任务管理' },
      { path: '/task/report', title: '举报审核' }
    ]
  },
  { path: '/task-cycle', title: '周期任务', icon: 'superpowers' },
  {
    title: '排行榜',
    icon: 'list-ol',
    children: [
      { path: '/leaderboard/order', title: '接单榜' },
      { path: '/leaderboard/invite', title: '推广榜' }
    ]
  },
  { path: '/withdraws', title: '提现审核', icon: 'calculator' },
  { path: '/bill', title: '账单流水', icon: 'paypal' },
  {
    title: '系统设置',
    icon: 'gear',
    children: [
      { path: '/setting/basic', title: '基础设置' },
      {
        title: '帮助中心',
        children: [
          { path: '/setting/help/help', title: '文章管理' },
          { path: '/setting/help/cate', title: '分类' }
        ]
      },
      // { path: '/setting/about', title: '关于我们' },
      { path: '/setting/contact-customer', title: '联系客服' },
      { path: '/setting/feed-back', title: '意见反馈' },
      { path: '/setting/doc', title: '文档管理' },
      // { path: '/setting/image', title: '图片管理' }
    ]
  }
])
